/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jschoolmanagerportable.gui.util;

import java.awt.Component;
import java.awt.Toolkit;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;

/**
 *
 * @author jc
 */
public class Dialogo {

    public static boolean alert(String titulo, String mensaje, Component ventana) {
        Object[] options = {"Aceptar"};
        boolean answer = alert(titulo, mensaje, ventana, options);
        return answer;
    }
    
    public static boolean alert(String titulo, String mensaje, Component ventana, Object[] options) {
        Toolkit.getDefaultToolkit().beep();
        //Object[] options = {"Editar", "Deshacer"};
        int answer = JOptionPane.showOptionDialog(SwingUtilities.getWindowAncestor(ventana), mensaje, titulo, JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]);

        if (answer == 1) {
            return true;
        }
        return false;
    }    
}
